#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

class Solution
{
public:
    void isUgly()
    {
        int a = 0, b = 0, c = 0, d = 0, e = 0;
        int n;
        string s_num;
        cin >> n;
        for (size_t i = 0; i < n; i++)
        {
            cin >> s_num;
            s_num = s_num.substr(4, 4); // 切割字符串，从索引位置4开始之后往后数4个位置的字符串
            if (s_num == "0706")
            {
                a += 1;
            }
            else if (s_num == "0703")
            {
                b += 1;
            }
            else if (s_num == "0710")
            {
                c += 1;
            }
            else if (s_num == "0711")
            {
                d += 1;
            }
            else
            {
                e += 1;
            }
        }
        cout << a << " ";
        cout << b << " ";
        cout << c << " ";
        cout << d << " ";
        cout << e << " ";
    }
};

int main()
{
    Solution test;
    test.isUgly();
    return 0;
}